package com;

@FunctionalInterface
interface IMyInterface {

    String hello();

    String toString();
}

public class MyInterfaceLambda {

    public static void printHello(IMyInterface iMyInterface) {
        System.out.println(1);
        System.out.println(iMyInterface.hello());
        System.out.println(2);
    }

    public static void main(String[] args) {
        MyInterfaceLambda.printHello(new IMyInterface() {
            @Override
            public String hello() {
                return "HELLO";
            }
        });

        MyInterfaceLambda.printHello(() -> "HELLO");

        IMyInterface iMyInterface = () -> "HELLO";
        System.out.println(iMyInterface);
        System.out.println(iMyInterface.getClass());
        System.out.println(iMyInterface.getClass().getSuperclass());
        System.out.println(iMyInterface.getClass().getInterfaces().length);
        System.out.println(iMyInterface.getClass().getInterfaces()[0]);
    }
}

